package com.ktjy.service;

import com.ktjy.dao.UserDao;
import com.ktjy.pojo.User;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

//四个注解是一个意思，都是在spring容器中生成一个bean
//@Component  无法定义该层，类似工具类
//@Repository  dao
//@Controller  springMVC servlet
@Service("userService")  //service
public class UserServiceImp implements UserService {

    @Autowired(required = true)
    @Qualifier(value = "userDao")
    UserDao aaa;

    @Override
    public int add(User user) {
        return aaa.add(user);
    }
}
